﻿using System;

class LeastMajorityMultiple
{
    static void Main(string[] args)
    {
        System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture;

        byte a = byte.Parse(Console.ReadLine());
        byte b = byte.Parse(Console.ReadLine());
        byte c = byte.Parse(Console.ReadLine());
        byte d = byte.Parse(Console.ReadLine());
        byte e = byte.Parse(Console.ReadLine());

        int result = 4;

        while (true)
        {
            byte divisibleCounter = 0;
            if (result % a == 0)
            {
                divisibleCounter++;
            }

            if (result % b == 0)
            {
                divisibleCounter++;
            }

            if (result % c == 0)
            {
                divisibleCounter++;
            }

            if (result % d == 0)
            {
                divisibleCounter++;
            }

            if (result % e == 0)
            {
                divisibleCounter++;
            }

            if (divisibleCounter >= 3)
            {
                break;
            }

            result++; ;
        }

        Console.WriteLine(result);
    }
}
